#ifndef FREEWAYSENDER_H_INCLUDED
#define FREEWAYSENDER_H_INCLUDED
#include <queue>

#include "FreeWayMsg1.h"

#include "../public/public0.h"
class FreeWayEntry;
class FreeWayMgr;






class FreeWaySender:public Threadable{
public:
    FreeWaySender( FreeWayMgr * mgrPtr);
    virtual ~FreeWaySender();
     virtual void svc();


    inline void setEntry(FreeWayEntry * en)
    {
        entry = en;

    }

    inline void pushdata(const char * buff, int l)
    {
        msgStruct1 *msg = new msgStruct1(buff,l);
         LOG(INFO) << "message" << msg->msgPtr;
        //lock
        lock(0);
        msgQueue.push(msg);
        unlock(0);

        //unlock
    }


    inline void setbrain(void * argp)
    {
        brainp = argp;
    }



protected:
    bool parseHead(const char * );

    FreeWayEntry * entry;
    FreeWayMgr * m_mgrptr;

    std::queue<msgStruct1*> msgQueue;


    bool run;

    void * brainp;


};




#endif // FREEWAYSENDER_H_INCLUDED
